<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 计算器 -->
		<input type="text" name="one" id="one" value="" />
		<select id="symbol">
			<option value ="a">+</option>
			<option value ="b">-</option>
			<option value ="c">*</option>
			<option value ="d">/</option>
		</select>
		<input type="text" name="two" id="two" value="" />
		<label>结果:</label>
		<input type="text" name="result" id="result" value="" />
		<button type="button" id="total" onclick="getresult();">计算</button>
	</body>
	<script type="text/javascript">
		function getresult(){
			var chose=document.getElementById("symbol").value
			var aa=parseFloat(document.getElementById("one").value)
			var bb=parseFloat(document.getElementById("two").value)
				if(chose=="a"){
					document.getElementById("result").value= (aa+bb).toFixed(4);
				}else if (chose=="b"){
					document.getElementById("result").value= (aa-bb).toFixed(4);
				}else if (chose=="c"){
					document.getElementById("result").value= (aa*bb).toFixed(4);
				}else if (chose=="d"){
					document.getElementById("result").value= (aa/bb).toFixed(4);
				}
			};
	</script>
</html>
